home *** CD-ROM | disk | FTP | other *** search
- class classes.enemy.BlasterA
- {
- var x;
- var y;
- var color;
- var moveScript;
- var id;
- var clip;
- var colorR;
- var trans;
- var colorTrans;
- var f2;
- var dir;
- var axis;
- var xDest;
- var yDest;
- var oldDir;
- var xMov = 0;
- var yMov = 0;
- var xMovT = 0;
- var yMovT = 0;
- var speedOrig = 6;
- var speed = 6;
- var xDestMet = false;
- var yDestMet = false;
- var c = 0;
- var life = 75;
- var nc = 0;
- var xA = 0;
- var yA = 0;
- var nudging = false;
- var power = 20;
- var hc = 0;
- var Name = "blasterA";
- function BlasterA(px, py, pcolor, pmoveScript, pid)
- {
- this.x = px;
- this.y = py;
- this.color = pcolor;
- this.moveScript = pmoveScript.slice();
- this.id = pid;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("blasterA","blasterA" + this.id + "Clip",_root.d + 50000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.speed *= _root.dif.speed;
- this.speedOrig = this.speed;
- this.life *= _root.dif.life;
- this.colorR = _root.randRange(-10,30);
- this.trans = new flash.geom.Transform(this.clip);
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,this.colorR,this.colorR,this.colorR,0);
- this.trans.colorTransform = this.colorTrans;
- this.clip.front.gotoAndStop(this.color);
- this.parseMoveScript();
- _root.stats.created = _root.stats.created + 1;
- }
- function nudge(pxA, pyA, pscale)
- {
- this.nc = 0;
- this.nudging = true;
- var _loc2_ = pscale / 400;
- this.xA = pxA * _loc2_;
- this.yA = pyA * _loc2_;
- }
- function bombed(num)
- {
- if(_root.subLevel != "3_1")
- {
- this.f2 = "death";
- }
- }
- function parseMoveScript()
- {
- var _loc2_ = this.dir;
- this.dir = this.moveScript[0];
- if(this.dir == "break")
- {
- delete this.moveScript;
- this.f2 = "";
- this.dir = _loc2_;
- this.blast();
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.f2 = "gotoXYDest";
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- if(this.dir == "L" || this.dir == "U")
- {
- this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
- }
- else
- {
- this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
- }
- this.moveScript.splice(0,2);
- }
- }
- function gotoXYDest()
- {
- if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
- {
- if(this.axis == "x")
- {
- this.x = this.xDest;
- }
- else
- {
- this.y = this.yDest;
- }
- this.parseMoveScript();
- }
- }
- function getDirString()
- {
- if(this.xMovT < -1)
- {
- this.dir = "L";
- }
- else if(this.xMovT > 1)
- {
- this.dir = "R";
- }
- else if(this.yMovT > 1)
- {
- this.dir = "D";
- }
- else if(this.yMovT < -1)
- {
- this.dir = "U";
- }
- }
- function leaving()
- {
- this.xMovT * 1.04;
- }
- function blast()
- {
- this.xMovT = 0;
- this.yMovT = 0;
- this.clip.blaster.gotoAndPlay("go");
- this.clip.flame.gotoAndPlay("still");
- this.f2 = "blasting";
- this.c = 0;
- _root.audio.playLevel2("blaster" + (random(3) + 1),_root.randRange(35,45));
- }
- function blasting()
- {
- this.c = this.c + 1;
- if(this.c == 16)
- {
- var _loc3_ = this.dir != "L" ? 39 : 0;
- _root["blasterALaser" + this.id] = new classes.shots.BlasterALaser(this.x + _loc3_,this.y,this.color,this.dir,this.id);
- _root.addEnemyShot("blasterALaser" + this.id);
- var _loc4_ = this.dir != "L" ? -100 : 100;
- this.nudge(_loc4_,0,100);
- }
- }
- function stopBlast()
- {
- this.xMovT = this.dir != "L" ? 15 : -15;
- this.f2 = "leaving";
- this.clip.flame.gotoAndPlay("start");
- }
- function death()
- {
- _root.stats.destroyed = _root.stats.destroyed + 1;
- _root.stats.score += 25000;
- _root.powerUp(this.x,this.y,90);
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(90,140),_root.randRange(80,100),"Red"]);
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-30,30),this.y + this.clip._height / 2 + _root.randRange(-30,30),_root.randRange(40,80),_root.randRange(70,100),"Purple"]);
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-30,30),this.y + this.clip._height / 2 + _root.randRange(-30,30),_root.randRange(50,80),_root.randRange(50,100),"Red"]);
- _root.createPowerUp([this.x,this.y,"coin25"]);
- _root.audio.playLevel4("blasterX" + (random(3) + 1),_root.randRange(25,35));
- var _loc3_ = 0;
- var _loc4_ = random(4) + 2;
- while(_loc3_ < _loc4_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"blasterA" + this.color,"Purple"]);
- _loc3_ = _loc3_ + 1;
- }
- _root.createEnemySoul([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"blue"]);
- _root.audio.playLevel4("blasterX",_root.randRange(25,35));
- _root.removeChar("blasterA" + this.id);
- this.f2 = "";
- }
- function death2()
- {
- _root.removeChar("blasterA" + this.id);
- this.f2 = "";
- }
- function main()
- {
- this[this.f2]();
- if(this.oldDir != this.dir)
- {
- this.clip.gotoAndStop(this.dir);
- }
- this.oldDir = this.dir;
- if(this.nudging)
- {
- this.xA *= 0.7;
- this.yA *= 0.7;
- this.nc = this.nc + 1;
- var _loc8_ = 255 - this.nc * 17;
- if(this.color == "Orange")
- {
- this.colorTrans.redOffset = _loc8_;
- this.colorTrans.greenOffset = _loc8_ / 2;
- }
- else if(this.color == "Blue")
- {
- this.colorTrans.blueOffset = _loc8_;
- this.colorTrans.greenOffset = _loc8_ / 2;
- }
- else
- {
- this.colorTrans.greenOffset = _loc8_;
- }
- this.trans.colorTransform = this.colorTrans;
- if(this.nc == 15)
- {
- this.xA = this.yA = 0;
- this.nudging = false;
- this.colorTrans.blueOffset = this.colorR;
- this.colorTrans.greenOffset = this.colorR;
- this.colorTrans.redOffset = this.colorR;
- this.trans.colorTransform = this.colorTrans;
- }
- }
- var _loc4_ = 0;
- var _loc7_ = _root.broShots.length;
- while(_loc4_ < _loc7_)
- {
- var _loc6_ = _root.broShots[_loc4_] + "Clip";
- if(this.clip.hitTest(_root[_loc6_]))
- {
- var _loc3_ = _root.broShots[_loc4_];
- var _loc5_ = this.life;
- this.life -= _root[_loc3_].power;
- if(this.life < 1)
- {
- this.f2 = "death";
- }
- else
- {
- this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,10);
- _root.audio.playLevel4("batHit" + (random(2) + 1),_root.randRange(20,35));
- }
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
- _root[_loc3_].exploX = this.x + this.clip._width / 2;
- _root[_loc3_].exploY = this.y + this.clip._height / 2;
- _root[_loc3_].hit(_loc5_);
- break;
- }
- _loc4_ = _loc4_ + 1;
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- this.f2 = "death";
- }
- if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
- {
- this.f2 = "death2";
- }
- if(this.xMovT < this.xMov)
- {
- this.xMov -= 0.3;
- }
- else if(this.xMovT > this.xMov)
- {
- this.xMov += 0.3;
- }
- else
- {
- this.xMov = this.xMovT;
- }
- if(this.yMovT < this.yMov)
- {
- this.yMov -= 0.3;
- }
- else if(this.yMovT > this.yMov)
- {
- this.yMov += 0.3;
- }
- else
- {
- this.yMov = this.yMovT;
- }
- this.x += this.xMov + this.xA;
- this.y += this.yMov + this.yA + 0.5 * Math.sin(this.hc += 0.05);
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-